package cn.edu.sspu.www.controller.common;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import cn.edu.sspu.www.exception.ErrorBean;
import cn.edu.sspu.www.exception.ErrorCode;

/**
 * 公共控制
 * @author warm
 * @version 2019年06月26日
 */
@Controller
@RequestMapping("/common")
public class CommonController {
	
	/**
	 * 设备状态日志列表查询
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/404")
    public ModelAndView noPageFound(HttpServletRequest request) {
				
        ErrorBean errorBean = new ErrorBean();
        errorBean = ErrorBean.getErrorBean(ErrorCode.PAGE_NOT_FOUND);
        errorBean.setTrace(request.toString());
        errorBean.setActionUrl(request.getRequestURI());
        
        ModelAndView modelAndView = new ModelAndView();     
        modelAndView.addObject("error", errorBean);
        modelAndView.setViewName("/common/404");
        
        return modelAndView;
    }
		
}
